Skip to content

[Enhancement✨] Add buyer_id_ref method for MessageTrait#6616

Merged
mxsm merged 1 commit intomxsm:mainfrom
slegarraga:feat-6588
Mar 1, 2026
Merged

[Enhancement✨] Add buyer_id_ref method for MessageTrait#6616
mxsm merged 1 commit intomxsm:mainfrom
slegarraga:feat-6588

Conversation

@slegarraga
Copy link
Contributor

@slegarraga slegarraga commented Mar 1, 2026

Motivation

Closes #6588

Modification

Added buyer_id_ref() method to MessageTrait that returns Option<&CheetahString> instead of cloning. This is consistent with existing _ref methods like tags_ref(), get_keys_ref(), and user_property_ref().

Result

Zero-copy access to buyer ID property, avoiding unnecessary string cloning.

Summary by CodeRabbit

  • New Features
    • Enhanced buyer ID property access in the messaging system, allowing more efficient retrieval and handling of buyer information data.

Add buyer_id_ref() method that returns Option<&CheetahString> instead of
cloning, consistent with existing _ref methods (tags_ref, get_keys_ref,
user_property_ref).

Closes mxsm#6588
@rocketmq-rust-bot
Copy link
Collaborator

🔊@slegarraga 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c59f59 and 67f71b5.

📒 Files selected for processing (1)
  • rocketmq-common/src/common/message.rs

Walkthrough

A new method buyer_id_ref() was added to the MessageTrait trait, providing a reference accessor for the buyer ID property that returns Option<&CheetahString>. The method uses the existing property_ref() mechanism alongside the current buyer_id() default implementation.

Changes

Cohort / File(s) Summary
New Trait Method
rocketmq-common/src/common/message.rs
Added buyer_id_ref(&self) -> Option<&CheetahString> method to MessageTrait, offering a reference-based accessor for the buyer ID property.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A reference so clean, a method so small,
The buyer_id_ref now answers the call,
No clone, no copy, just borrow with care,
A rabbit's addition, light as the air! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a buyer_id_ref method to MessageTrait.
Linked Issues check ✅ Passed The pull request fully implements the requirement from issue #6588: adding buyer_id_ref method returning Option<&CheetahString> to MessageTrait.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #6588; only the buyer_id_ref method was added with no extraneous modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.34%. Comparing base (c803c98) to head (67f71b5).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
rocketmq-common/src/common/message.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6616      +/-   ##
==========================================
- Coverage   41.52%   41.34%   -0.19%     
==========================================
  Files         961      963       +2     
  Lines      134645   135226     +581     
==========================================
- Hits        55909    55906       -3     
- Misses      78736    79320     +584     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - All CI checks passed ✅

Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mxsm mxsm merged commit da0bba5 into mxsm:main Mar 1, 2026
10 of 21 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement✨] Add buyer_id_ref method for MessageTrait

4 participants